import socket

# 创建一个 TCP/IP 套接字
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# 服务器地址和端口
server_address = ('localhost', 10000)

# 连接到服务器
client_socket.connect(server_address)

# 要发送的字节数组
# message = b'Hello, Server!'
# 要发送的字符串
message = '我是中国人'

# 将字符串编码为字节字符串
message_bytes = message.encode('utf-8')

# 发送字节数组
client_socket.sendall(message_bytes)

# 关闭连接
client_socket.close()